import { handleActions } from 'redux-actions'

const defaultData = {
	pickOptions: [],
	displayName: '',
	isMandatory: 0,
	isPublicVisible: 0,
	isEnabled: 1,
  isEnabledEditable: 1,
  isMandatoryEditable: 1,
  isPublicVisibleEditable: 1,
  profileFieldId: null,
  profileTemplateId: null,
  referenceName: '',
  typeSpec: null,
  containerId: null
}

export default handleActions({

	'fetch profile template field detail': (state, { payload }) => {
		return {
			state
		}
	},

	'clear profile template field detail': (state, action) => {
		return {
			...state,
			...defaultData
		}
	},

	'update profile template field detail': (state, { payload }) => {
		return {
			...state,
			...payload
		}
	}
}, defaultData)
